package com.zq.designpaterns.create.absfactory;

import com.zq.designpaterns.create.enums.AbsFactoryType;

import java.util.Objects;

/**
 * ================================================
 * 作    者：程志强
 * 邮    箱：cheng.zhiqiang@cesgroup.com.cn
 * 版    本：1.0.0
 * 创建日期：2021/01/11  11:09
 * 修改日期：
 * 描    述：工厂创造器/生成器类
 * 修订历史：
 * ================================================
 */
public class FactoryProducer {
    public static AbstractFactory getFactory(AbsFactoryType type) {
        if (Objects.isNull(type)) {
            return null;
        }
        switch (type) {
            case SHAPE:
                return new ShapeFactory();
            case COLOR:
                return new ColorFactory();
            default:
                return null;
        }
    }
}
